package com.jc.constant;

public enum ProductCategoryEnum {
    ELECTRONICS("01", "家用电器、电脑及其周边产品"),
    VEHICLES("02", "汽车、模特车及其零配件"),
    CHEMICALS("03", "医药化学品"),
    AGRICULTURE("04", "农产品及农药、化肥"),
    TEXTILES("05", "纺织品、皮革及其制品"),
    METALS("06", "金属及其制品"),
    FURNITURE("07", "家具"),
    CERAMICS("08", "陶瓷产品"),
    COMMUNICATION("09", "通讯产品"),
    SOLAR("10", "光伏产品"),
    FUEL("11", "燃料"),
    MACHINERY("12", "机械及其零部件"),
    SHIP("13", "船舶、零件及修理"),
    CIRCUIT_BOARD("14", "印刷电路板及原材料"),
    TOYS("15", "玩具"),
    OTHER("16", "其他");

    private final String code;
    private final String name;

    ProductCategoryEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ProductCategoryEnum getByCode(String code) {
        for (ProductCategoryEnum item : ProductCategoryEnum.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
}